package com.example.zbh.dsliao.ui.activty;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;

import com.example.zbh.dsliao.R;

/**
 * 闪屏页面
 */
public class SplachActivity extends Activity implements View.OnClickListener {

    private Button enterBtn;
    private Handler handler;
    private Runnable runnable = new Runnable() {
        @Override
        public void run() {
            isIntent();
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splach);

        enterBtn = (Button) findViewById(R.id.enterBtn);
        enterBtn.getBackground().setAlpha(50);
        enterBtn.setOnClickListener(this);
        handler = new Handler();
        handler.postDelayed(runnable, 8000);

    }


    /**
     * 跳转
     * **/
    private void isIntent() {
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
        finish();
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.enterBtn:
                isIntent();
                handler.removeCallbacks(runnable);
                break;
        }
    }



}
